home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Topik / Topik - Disk 37 - Games 3 (19xx)(Topik Public Domain)(PD)[WB].zip / Topik - Disk 37 - Games 3 (19xx)(Topik Public Domain)(PD)[WB].adf / RUMMY / SOURCE / defns.h.pp / defns.h
C/C++ Source or Header  |  1991-02-24  |  4KB  |  199 lines

  1. /* DEFNS.H
  2.  * This file contains global definitions of structure members to be #included
  3.  * file which needs them; no data is allocated storage here, and no extern
  4.  * declarations appear. Instances of these data types are allocated in the
  5.  * file DECL.C whose compiled form is linked with other modules. Various
  6.  * #defines are also set up in here.
  7.  */
  8.  
  9. struct    card
  10. {
  11.     unsigned n:4;    /* card number */
  12.     unsigned s:2;    /* card suit */
  13. };
  14.  
  15. struct    set
  16. {
  17.     struct    card    cards[15];
  18.     USHORT    ncard;
  19. };
  20.  
  21.  
  22. struct    playerinfo
  23. {
  24.     USHORT    viewcard,manctrl;
  25.     char    name[18];
  26.     USHORT    level;    /* playing level */
  27.     USHORT    wins;    /* number of hands won by player */
  28.     USHORT    playernum;
  29.     struct    Image    *cards; /* linked list of image structures of cards held */
  30.     USHORT    nchld,xc,yc,score;    /* number of cards held */
  31.     struct    card    hand[8];    /* cards held by player */
  32.     USHORT    mem[53];    /* store location of each card */
  33.     USHORT    turn;
  34. };
  35.  
  36. struct custptr
  37. {
  38.     USHORT    *ptr;
  39.     SHORT    h,w,x,y;
  40. };
  41.  
  42. struct    suitset
  43. {
  44.     USHORT    nc;
  45.     struct    card    c[16];
  46. };
  47.  
  48. struct    numset
  49. {
  50.     USHORT    nc;
  51.     struct    card    c[5];
  52. };
  53.  
  54. struct    condset
  55. {
  56.     USHORT    ns,score,nd,ig,type,addtoset,uc;
  57.     struct    card    set[10],dep[10];
  58. };
  59.  
  60.  
  61.  
  62. /***** defines *****/
  63. /* menus */
  64. #define    FHEIGHT    8
  65. #define    FWIDTH    8
  66. #define    MENUCOL1    4
  67. #define    MENUCOL2    1
  68. #define    SMOS    10*FWIDTH
  69. #define    SMVOS    FHEIGHT >> 1
  70. /* smos = Sub menu (vertical) offset (from its menu item left edge)*/
  71. #define    PROJMENU    0
  72. #define    INTELLMENU    1
  73. #define    DEBUGMENU    2
  74. #define    VERIFYMENU    3
  75.  
  76. /* suits */
  77. #define    DM    0
  78. #define    HT    1
  79. #define    CL    2
  80. #define    SP    3
  81. #define    JACK    11
  82. #define    QUEEN    12
  83. #define    KING    13
  84. #define    ACE    1
  85. #define    CARDW    64
  86. #define    CARDH    48
  87.  
  88.  
  89. /* memory cell location flags */
  90. #define    UNKNOWN    0
  91. #define    PREVPLRHOLDS    1
  92. #define    CURRPLRHOLDS    2
  93. #define    NEXTPLRHOLDS    4
  94. #define    PREVPLRDROPD    8
  95. #define    CURRPLRDROPD    16
  96. #define    NEXTPLRDROPD    32
  97. #define    GONEPAST    64
  98. #define    INFUPSET    128
  99.  
  100. /* gadget defintions */
  101. #define    FUPX    94
  102. #define    FUPY    14
  103. #define    FDPX    10
  104. #define    FDPY    14
  105.  
  106. /* gadget ids */
  107. #define    N1G    0
  108. #define    N2G    1
  109. #define    N3G    2
  110. #define    CONTG    3
  111. #define    SUBMITG    4
  112. #define    FUPG    5
  113. #define    FDPG    6
  114. #define    NHANDG    7
  115. #define    ADDG    8
  116.  
  117. #define    HANDG1    31
  118. #define    HANDG2    32
  119. #define    HANDG3    33
  120. #define    HANDG4    34
  121. #define    HANDG5    35
  122. #define    HANDG6    36
  123. #define    HANDG7    37
  124.  
  125. #define    SETGAD0    40
  126. #define    SETGAD1    41
  127. #define    SETGAD2    42
  128. #define    SETGAD3    43
  129. #define    SETGAD4    44
  130. #define    SETGAD5    45
  131.  
  132. #define    PROCG    100
  133.  
  134. #define    MMSETFG    110
  135. #define    MMACCEPTG    111
  136. #define    MMCANCELG    112
  137. #define    CARDG    5000
  138.  
  139. #define    MDAUTODG    200
  140. #define    MDACCEPTG    201
  141.  
  142. /* position of display areas */
  143. #define    P1DX    0
  144. #define    P2DX    0
  145. #define    P3DX    0
  146. #define    P1DY    71
  147. #define    P2DY    131
  148. #define    P3DY    191
  149. #define    IDX    0
  150. #define    IDY    0
  151. #define    SCTPX    180
  152. #define    SCTPY    14
  153. #define    HVTPX    180
  154. #define    HVTPY    23
  155. #define    NWTPX    180
  156. #define    NWTPY    32
  157. #define    NGPX    175
  158. #define    NGPY    1
  159. #define    MESX    180
  160. #define    MESY    30
  161. #define    NHGADX    170+15*FWIDTH
  162. #define    NHGADY    39
  163. #define    HANDLEFT    106
  164. #define    HANDTOP    2
  165.  
  166. /*defines used in accessing initpack[]/shufpack[]*/
  167. #define    BEFOREHAND    0
  168. #define    BEFOREGAME    1
  169.  
  170. /*macros for accessing packs and hands of cards*/
  171. #define    NEXTFDP    fdptc==1 ? rvspk() : fdp[fdptc--]
  172. #define    PUTFDP(card)     fdp[++fdptc]=card
  173. #define    NEXTFUP    fuptc==0?nulcard:fup[fuptc--]
  174. #define    PUTFUP(card)    fup[++fuptc]=card
  175. #define    NEXTPLC(plrinfo)    plrinfo->nchld==0?nulcard:plrinfo->hand[plrinfo->nchld--]
  176. #define    PUTPLC(plrinfo,card)    plrinfo->hand[++plrinfo->nchld]=card
  177.  
  178. #define    CARD(n,s)    ((s)*13+(n))
  179. #define    CARD2(c)    ((c).s*13+(c).n)
  180. #define    WAITCONT    for(cont=0;!cont && !quit && !exgm;) {Wait(1<<mp->mp_SigBit); ReplyMsg(GetMsg(mp));}
  181. #define    TXTOUT(x,y,f,b,t)    gt.FrontPen=(f);gt.BackPen=(b);gt.IText=(UBYTE *)(t);PrintIText(wind->RPort,>,x,y);
  182. #define    DRAWFUP    DrawImage(wind->RPort,packim[0][CARD2(fup[fuptc])],FUPX,FUPY);
  183. #define    CDEQU(c1,c2)    ((c1).n==(c2).n && (c1).s==(c2).s)
  184. #define    DRAWFDP    DrawImage(wind->RPort,packim[0][CARD2(fdp[fdptc])],FDPX,FDPY);
  185. #define    REMHAND(p)    DrawImage(wind->RPort,&handrem,0,(p)->yc+HANDTOP);
  186.  
  187.  
  188. /* ptr stack macros */
  189. #define    SETPTR(p)    SetPointer(wind,(p).ptr,(p).h,(p).w,(p).x,(p).y);
  190.  
  191. #define    ISNUL(c) ((c).n==0)
  192. #define NOTSET    0
  193. #define    SUITSET    1
  194. #define    NUMSET    2
  195. #define    SUB    4
  196. #define    ADD    8
  197. #define    TOSTART    16
  198. #define    TOEND    32
  199.